<template>
  <div id="introduce_near" ref="introduce_near">
    <c-title :hide="false" text="门店附近推荐商品"></c-title>
    <div class="content">
        <div class="good-number">
            商品展示数量:<span>{{show_num}}</span>
        </div>
        <div class="without" v-if="datas.length<=0">
          <img src="../../../assets/images/wushangpin@2x.png">
          <div>暂无选择商品</div>
        </div>
        <div class="list" v-if="datas.length>0">
          <div class="item" v-for="(item,index) in datas" :key="index">
            <div class="img" v-if="!fun.isTextEmpty(item.has_one_goods)">
              <img :src="item.has_one_goods.change_thumb">
            </div>
            <div class="info" v-if="!fun.isTextEmpty(item.has_one_goods)">
              <div class="title" v-if="!fun.isTextEmpty(item.has_one_goods)">{{item.has_one_goods.title}}</div>
              <div class="bottom">
                <span class="money" v-if="!fun.isTextEmpty(item.has_one_goods)"><span class="money-tag">{{$i18n.t('money')}}</span>{{item.has_one_goods.price}}</span>
                <span class="delete" @click="del(item)">删除</span>
              </div>
            </div>
          </div>
        </div>
    </div>
    <div class="add" @click="toAdd">
        <!-- <img src="../../../assets/images/zhibo_add@2x.png"> -->
        <span class="add-icon">
          <van-icon name="plus" />
        </span>
    </div>
  </div>
</template>

<script>
import introduce_near_controller from "./introduce_near_controller";

export default introduce_near_controller;
</script>

<style lang="scss" rel="stylesheet/scss" scoped>
#introduce_near {
  // background-color: #fff;
  position: relative;

  .content {
    padding-bottom: 1rem;
    // background-color: #fff;

    .list {
      border-radius: 0.3125rem;
      margin: 0.8rem;
      padding: 0 0.8rem;
      background: white;

      .item:last-child {
        border-bottom: none;
      }

      .item {
        display: flex;
        padding: 0.8rem 0;
        background-color: #fff;
        border-bottom: 0.05rem solid #E7E7E7;

        .img {
          display: flex;
          width: 4.8rem;
          height: 4.8rem;
          border-radius: 0.3125rem;
          box-sizing: border-box;

          img {
            width: 100%;
            height: 100%;
          }
        }

        .info {
          display: flex;
          flex-direction: column;
          justify-content: space-between;
          text-align: center;
          margin-left: 0.5rem;
          flex: 1;

          .title {
            font-weight: 500;
            text-align: left;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            font-size: 0.9rem;
            color: #00001C;
          }

          .bottom {
            display: flex;
            justify-content: space-between;
            align-items: center;

            .money {
              font-size: 0.95rem;
              color: #F15353;
              .money-tag {
                font-size: 0.75rem;
              }
            }

            .delete {
              width: 4rem;
              font-size: 12px;
              box-sizing: border-box;
              display: flex;
              align-items: center;
              justify-content: center;
              border-radius: 1rem;
              color: #f01414;
              border: solid 1px #F15353;
              padding: 0.35rem 0;
            }
          }
        }
      }
    }

    .good-number {
      font-size: 0.85rem;
      background: white;
      color: #00001C;
      text-align: left;
      padding: 0.925rem 0.6rem;
    }

    .without {
      margin: 0 auto;
      margin-top: 2rem;

      img {
        display: inline-block;
        width: 4.375rem;
        height: 5.125rem;
      }

      div {
        margin-top: 1rem;
        color: #999;
        font-size: 14px;
      }
    }
  }

  .add {
    position: fixed;
    bottom: 4rem;
    width: 2.625rem;
    height: 2.625rem;
    box-sizing: border-box;
    right: 1rem;

    .add-icon {
      width: 3rem;
      height: 3rem;
      background: rgba(0,0,0,0.7);
      border-radius: 50%;
      display: flex;
      justify-content: center;
      align-items: center;
      
      .van-icon {
        color: white;
        zoom: 1.6;
      }
    }
  }
}
</style>
